/**
 * 安卓白金英雄坛制作组 <br>
 * 文件名：vs.java <br>
 * 创建时间：2014-1-26 下午10:02:29 <br>
 * 所属项目：GmudEX <br>
 * @author 12548 <br>
 */
package lostland.gmud.exv2.expand;

import lostland.gmud.exv2.Gmud;

public class vs {

	public vs(int player1, int player2) {
		super();
		this.player1 = player1;
		this.player2 = player2;
		ensure();
	}

	public int player1;
	public int player2;

	void ensure() {
		if (player2 == -1) {
			int t = player1;
			player1 = player2;
			player2 = t;
		}
	}

	public void refresh() {
		if (player1 > -1)
			Gmud.getNpc(player1).refresh();
		else
			Gmud.mc.refresh();
		Gmud.getNpc(player2).refresh();
	}

	public boolean isAttended() {
		return player1 == -1;
	}

	@Override
	public String toString() {
		vs i = this;

		String tt = "";
		if (i.player1 == -1)
			tt += Gmud.mc.name;
		else
			tt += Gmud.getNpc(i.player1).name;

		tt += " 对 ";

		tt += Gmud.getNpc(i.player2).name;

		return tt;
	}
}
